package com.wd.tw.domain.vo;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import lombok.Data;

/**
 * @className: EleRunData
 * @description: TODO 类描述
 * @author: liumingkun
 * @date: 2025/1/11
 **/
@Data
public class EleRunData {

    private Long elevatorId;

    private String elevatorName;

    private Long runTimes;

    private Long startTime;

    private String recordDate;


    public long getRunTM(){
        // 给定时间戳
        long timestamp = this.getStartTime();

        // 将时间戳转换为 Date 对象
        java.util.Date givenTime = DateUtil.date(timestamp * 1000);  // 转换为毫秒

        // 获取给定时间戳对应日期的 23:59:59
        java.util.Date endOfDay = DateUtil.endOfDay(givenTime);

        // 计算当前时间到给定时间戳当天23:59:59之间的分钟差
        long diffInMinutes = DateUtil.between(givenTime, endOfDay, DateUnit.MINUTE);
        return diffInMinutes;
    }
}
